{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "iQjHqsmTAVLU"
   },
   "source": [
    "## Exercise 3\n",
    "In the videos you looked at how you would improve Fashion MNIST using Convolutions. For your exercise see if you can improve MNIST to 99.8% accuracy or more using only a single convolutional layer and a single MaxPooling 2D. You should stop training once the accuracy goes above this amount. It should happen in less than 20 epochs, so it's ok to hard code the number of epochs for training, but your training must end once it hits the above metric. If it doesn't, then you'll need to redesign your layers.\n",
    "\n",
    "I've started the code for you -- you need to finish it!\n",
    "\n",
    "When 99.8% accuracy has been hit, you should print out the string \"Reached 99.8% accuracy so cancelling training!\"\n",
    "\n",
    "## 练习3\n",
    "在视频中，你看了如何使用卷积来提高Fashion MNIST的识别率。通过这个练习，看看可否只使用单个卷积层和单个MaxPooling 2D将MNIST（手写数字）识别率提高到99.8%或更高的准确率。一旦准确率超过这个数值，应该停止训练。Epochs不应超过20个。如果epochs达到20但精度未达到要求，那么就需要重新设计层结构。\n",
    "\n",
    "程序的框架已经有了--请完成它!\n",
    "\n",
    "当达到99.8%的准确率时，你应该打印出 \"达到99.8%准确率，所以取消训练！\"的字符串。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {},
    "colab_type": "code",
    "id": "sfQRyaJWAIdg"
   },
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "\n",
    "# YOUR CODE STARTS HERE\n",
    "\n",
    "# YOUR CODE ENDS HERE\n",
    "\n",
    "mnist = tf.keras.datasets.mnist\n",
    "(training_images, training_labels), (test_images, test_labels) = mnist.load_data()\n",
    "\n",
    "# YOUR CODE STARTS HERE\n",
    "\n",
    "# YOUR CODE ENDS HERE\n",
    "\n",
    "model = tf.keras.models.Sequential([\n",
    "    # YOUR CODE STARTS HERE\n",
    "\n",
    "    # YOUR CODE ENDS HERE\n",
    "])\n",
    "\n",
    "# YOUR CODE STARTS HERE\n",
    "\n",
    "# YOUR CODE ENDS HERE\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "collapsed_sections": [],
   "name": "Exercise 3 - Question.ipynb",
   "provenance": [],
   "version": "0.3.2"
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
